Skip to main content

Running Your Own Node

IMPORTANT: Who This Guide Is Forโ€‹

This guide is for:โ€‹

  • ๐Ÿ”ฌ Developers testing applications locally
  • ๐Ÿ–ฅ๏ธ Power users who want to run infrastructure
  • ๐Ÿข Enterprises running private deployments
  • ๐Ÿงช Researchers experimenting with SELF Chain

This guide is NOT for:โ€‹

  • โŒ Regular users - You get cloud automatically via Super-App!
  • โŒ App developers - You don't need to run nodes, just use the SDK
  • โŒ People trying to "save money" - The Super-App is easier and managed

Why Run Your Own Node?โ€‹

Most users should NOT run their own node. The SELF Super-App automatically provisions and manages everything for you. However, you might want to run a node if:

  1. Local Development: Test your apps without using testnet resources
  2. Enterprise Deployment: Run SELF Chain in your private infrastructure
  3. Network Support: Contribute to network decentralization as a validator
  4. Research: Experiment with blockchain and AI integration

The Easy Way: Use the Super-Appโ€‹

Before diving into manual node operation, remember:

For 99% of users, just:

  1. Download SELF Super-App
  2. Sign up
  3. Done! Your cloud is ready

Only continue if you have a specific technical need.

System Requirementsโ€‹

Minimum Requirements (Testnet)โ€‹

  • CPU: 2 cores (x86_64 or ARM64)
  • RAM: 4GB
  • Storage: 50GB SSD
  • Network: 100 Mbps stable connection
  • OS: Ubuntu 20.04+ or similar Linux distribution
  • CPU: 4+ cores
  • RAM: 8GB+
  • Storage: 200GB+ SSD
  • Network: 1 Gbps connection
  • OS: Ubuntu 22.04 LTS

Quick Start with Dockerโ€‹

1. Install Dockerโ€‹

# Update system
sudo apt update && sudo apt upgrade -y

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Add user to docker group
sudo usermod -aG docker $USER

2. Run SELF Chain Nodeโ€‹

# Pull the latest image
docker pull selfchain/node:latest

# Create data directory
mkdir -p ~/self-node-data

# Run the node
docker run -d \
--name self-node \
-p 8000:8000 \
-p 3030:3030 \
-v ~/self-node-data:/data \
selfchain/node:latest \
--config /data/config.toml

3. Run Private LLMโ€‹

# Pull Ollama image
docker pull ollama/ollama:latest

# Run Ollama
docker run -d \
--name ollama \
-p 11434:11434 \
-v ~/ollama:/root/.ollama \
ollama/ollama:latest

# Pull a model (e.g., Phi-3)
docker exec -it ollama ollama pull phi3:mini

Configurationโ€‹

Basic Configuration (config.toml)โ€‹

# Node Configuration
[node]
name = "my-self-node"
data_dir = "/data"

# Network Configuration
[network]
chain_id = "self-testnet-001"
p2p_port = 8000
api_port = 3030
bootstrap_nodes = [
"http://13.220.156.247:3030",
"http://34.203.202.6:3030",
"http://52.23.226.218:3030"
]

# Consensus
[consensus]
algorithm = "poai"
validator = false # Set to true if running a validator

# Storage
[storage]
ipfs_enabled = true
orbitdb_enabled = true

# AI Configuration
[ai]
endpoint = "http://localhost:11434/v1"
model = "phi3:mini"
max_tokens = 1024

Using Docker Composeโ€‹

For easier management, use Docker Compose:

docker-compose.ymlโ€‹

version: '3.8'

services:
self-node:
image: selfchain/node:latest
container_name: self-node
ports:
- "8000:8000"
- "3030:3030"
volumes:
- ./data:/data
- ./config.toml:/data/config.toml
environment:
- RUST_LOG=info
restart: unless-stopped
depends_on:
- ollama
- ipfs

ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
volumes:
- ./ollama:/root/.ollama
restart: unless-stopped

ipfs:
image: ipfs/kubo:latest
container_name: ipfs
ports:
- "4001:4001"
- "5001:5001"
- "8080:8080"
volumes:
- ./ipfs:/data/ipfs
restart: unless-stopped

Start all services:

docker-compose up -d

Manual Installation (Advanced)โ€‹

1. Build from Sourceโ€‹

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

# Clone repository
git clone https://github.com/SELF-Software/self-chain-public.git
cd self-chain-public

# Build
cargo build --release

# Binary will be at ./target/release/self-chain-node

2. Install IPFSโ€‹

# Download IPFS
wget https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz
tar -xvzf kubo_v0.24.0_linux-amd64.tar.gz
cd kubo
sudo bash install.sh

# Initialize IPFS
ipfs init

3. Install Ollamaโ€‹

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Start Ollama service
sudo systemctl start ollama

# Pull a model
ollama pull phi3:mini

Node Operationsโ€‹

Check Node Statusโ€‹

# Via API
curl http://localhost:3030/info

# Via Docker logs
docker logs self-node

Monitor Performanceโ€‹

# Resource usage
docker stats self-node ollama ipfs

# Node metrics
curl http://localhost:3030/metrics

Backup Node Dataโ€‹

# Stop node
docker-compose down

# Backup data
tar -czf self-node-backup-$(date +%Y%m%d).tar.gz ./data

# Restart node
docker-compose up -d

Connecting to Testnetโ€‹

  1. Ensure your firewall allows connections on ports 8000 and 3030
  2. Your node will automatically connect to bootstrap nodes
  3. Monitor peer connections:
curl http://localhost:3030/peers

Running a Validator Nodeโ€‹

To participate in consensus as a validator:

  1. Stake Requirements: Minimum stake required (see current requirements)
  2. Uptime: Maintain 95%+ uptime
  3. Hardware: Use recommended specifications
  4. Configuration: Set validator = true in config.toml

Troubleshootingโ€‹

Node Won't Startโ€‹

  • Check port availability: sudo lsof -i :8000
  • Verify config file syntax
  • Check Docker logs: docker logs self-node

Can't Connect to Peersโ€‹

  • Ensure firewall rules allow P2P port (8000)
  • Check bootstrap nodes are reachable
  • Verify network connectivity

High Resource Usageโ€‹

  • Reduce AI model size
  • Limit IPFS bandwidth
  • Adjust resource limits in Docker

Security Considerationsโ€‹

  1. Firewall: Only expose necessary ports
  2. Updates: Keep node software updated
  3. Backups: Regular backups of node data
  4. Monitoring: Set up alerts for anomalies
  5. Keys: Secure your node's private keys

Cloud Provider Guidesโ€‹

AWS EC2โ€‹

  • Use t3.medium or larger
  • Security group: Allow ports 8000, 3030
  • Attach EBS volume for data persistence

Google Cloudโ€‹

  • Use e2-medium or larger
  • Firewall rules for P2P and API
  • Use persistent disk for data

DigitalOceanโ€‹

  • Use 4GB droplet or larger
  • Configure firewall via UI
  • Use block storage for data

Hetznerโ€‹

  • Use CX21 or larger
  • Configure firewall rules
  • Use volume for data storage

Getting Helpโ€‹


Note: This guide covers running SELF Chain nodes on your own infrastructure. For automatic provisioning through the Super-App, users don't need to manage any of this complexity.